import 'package:flutter/foundation.dart';
import 'package:flutter_project/core/http/http_manager.dart';
import 'package:flutter_project/model/admin.dart';

class UserDao {
  /// 注册
  static Future<Null> register({
    @required String phone,
    @required String password,
    @required String name,
    int gender,
  }) async {
    await http.post<Map>('/user/register', queryParameters: {
      "phone": phone,
      "password": password,
      "name": name,
      "gender": gender
    });
  }

  /// 登录
  static Future<AdminMap> login({
    @required String phone,
    @required String password
  }) async {
    var resp = await http.post<Map>('/user/login',
        queryParameters: {'phone': phone, 'password': password});
    return AdminMap.fromJson(resp.data);
  }
}
